import time
import mujoco
import mujoco.viewer
from os.path import dirname, join, abspath
# modeldir = join(dirname(dirname(dirname(__file__))), "model")
# m = mujoco.MjModel.from_xml_path(join(modeldir, 'humanoid/humanoid.xml'))

m = mujoco.MjModel.from_xml_path(join(dirname(__file__),'inverted_pendulum.xml')) 
d = mujoco.MjData(m)


with mujoco.viewer.launch_passive(m, d) as viewer:
  # Close the viewer automatically after 30 wall-seconds.
  start = time.time()
  while viewer.is_running() and time.time() - start < 60:
    step_start = time.time()